<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
    <style>
        div{
            height:100px;
            width:100px;
            border:blue solid 10px;
            padding: 20px;
            margin: 30px;
        }
    </style>
<body>
    <div></div>
    <script>
        //可以动态获取元素的信息
        var div= document.querySelector('div');
        console.log(div.offsetTop);
        console.log(div.offsetLeft);
        console.log(div.offsetWidth);//返回包括padding，margin，width
        console.log(div.offsetHeight);
    </script>

</body>
</html>